﻿//声明hub代理
var chat = $.connection.chatHub;
//创建后端要调用的前端function
chat.client.sendNotify = function (message) {
    layui.use(["okToastr"], function () {
        var okToastr = layui.okToastr;
        okToastr.info(message);
    });

};
//对应后端的SendMessage函数，消息接收函数
chat.client.sendMessage = function (message) {
    layui.use(["okToastr"], function () {
        var okToastr = layui.okToastr;
        okToastr.info(message);
    });
};
//开启链接
$.connection.hub.start().done(function () {
    var user = { "NickName": 'LIN', "Id": '99999' };
    //发送上线信息
    chat.server.sendLogin(user);
});
history.pushState(null, null, document.URL);
window.addEventListener("popstate", function (e) {
    history.pushState(null, null, document.URL);
}, false);